package com.smec.moblie.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.smec.moblie.R;
import com.smec.moblie.bean.MaintenanceFastrepairhisBean;
import com.smec.moblie.crash.ExitAppUtils;

/**
 * 急修历史详情
 * Created by sunyubo on 16/2/25.
 */
public class FastrepairHistoryDetailActivity extends BaseActivity {

    /**
     * 工单编号
     **/
    private TextView textView_workorder_no;
    /**
     * 保养合同号
     **/
    private TextView textView_mnt_contract_no;
    /**
     * 现场地址
     **/
    private TextView textView_onsite_address;
    /**
     * 报修日期
     **/
    private TextView textView_report_date;
    /**
     * 报修内容
     **/
    private TextView textView_report;
    /**
     * 处理部门
     **/
    private TextView textView_process_org_name;
    /**
     * 工单创建日期
     **/
    private TextView extView_create_date;
    /**
     * 受信方式
     **/
    private TextView textView_SR_TYPE_CODE;
    /**
     * 故障性质
     **/
    private TextView textView_FAILURE_PROPERTY_CODE;
    /**
     * 保养人员
     **/
    private TextView textView_assignee;
    /**
     * 电梯合同号
     **/
    private TextView textView_ele_contract_no;
    /**
     * 急修接收人
     **/
    private TextView textView_accept_user;
    /**
     * 工单分派人
     **/
    private TextView textView_assign_user;
    /**
     * 到达时间
     **/
    private TextView textView_onsite_date;
    /**
     * 接单时间
     **/
    private TextView textView_accept_date;
    /**
     * 完成时间
     **/
    private TextView textView_finish_date;
    /**
     * 修理情况
     **/
    private TextView textView_repair;
    /**
     * 急修单备注信息
     **/
    private TextView textView_COMMENTS;
    /** 返回按钮 **/
    private ImageView imageview_back;

    private RelativeLayout rl_title;

    @Override
    protected void setContentView() {
        setContentView(R.layout.remes_act_fastrepairhistorydetail);
    }

    @Override
    protected void initView() {
        ExitAppUtils.getInstance().addActivity(this);

        rl_title = (RelativeLayout)findViewById(R.id.rl_title);
//        PublicControl.setMargins(rl_title, 0, getStatusBarHeight(FastrepairHistoryDetailActivity.this), 0, 0);

        textView_workorder_no = (TextView) findViewById(R.id.textView_workorder_no);
        textView_mnt_contract_no = (TextView) findViewById(R.id.textView_mnt_contract_no);
        textView_onsite_address = (TextView) findViewById(R.id.textView_onsite_address);
        textView_report_date = (TextView) findViewById(R.id.textView_report_date);
        textView_report = (TextView) findViewById(R.id.textView_report);
        textView_process_org_name = (TextView) findViewById(R.id.textView_process_org_name);
        extView_create_date = (TextView) findViewById(R.id.extView_create_date);
        textView_SR_TYPE_CODE = (TextView) findViewById(R.id.textView_SR_TYPE_CODE);
        textView_FAILURE_PROPERTY_CODE = (TextView) findViewById(R.id.textView_FAILURE_PROPERTY_CODE);
        textView_assignee = (TextView) findViewById(R.id.textView_assignee);
        textView_ele_contract_no = (TextView) findViewById(R.id.textView_ele_contract_no);
        textView_accept_user = (TextView) findViewById(R.id.textView_accept_user);
        textView_assign_user = (TextView) findViewById(R.id.textView_assign_user);
        textView_onsite_date = (TextView) findViewById(R.id.textView_onsite_date);
        textView_accept_date = (TextView) findViewById(R.id.textView_accept_date);
        textView_finish_date = (TextView) findViewById(R.id.textView_finish_date);
        textView_repair = (TextView) findViewById(R.id.textView_repair);
        textView_COMMENTS = (TextView) findViewById(R.id.textView_COMMENTS);

        imageview_back = (ImageView) findViewById(R.id.imageview_back);
        imageview_back.setOnClickListener(this);
    }

    @Override
    protected void getData() {
        MaintenanceFastrepairhisBean maintenanceFastrepairhisBean = (MaintenanceFastrepairhisBean) getIntent().getSerializableExtra("MaintenanceFastrepairhisBean");
        if (null != maintenanceFastrepairhisBean) {
            textView_workorder_no.setText(maintenanceFastrepairhisBean.getWorkorder_no());
            textView_mnt_contract_no.setText(maintenanceFastrepairhisBean.getMnt_contract_no());
            textView_onsite_address.setText(maintenanceFastrepairhisBean.getOnsite_address());
            textView_report_date.setText(maintenanceFastrepairhisBean.getReport_date());
            textView_report.setText(maintenanceFastrepairhisBean.getReport());
            textView_process_org_name.setText(maintenanceFastrepairhisBean.getProcess_org_name());
            extView_create_date.setText(maintenanceFastrepairhisBean.getCreate_date());
            textView_SR_TYPE_CODE.setText(maintenanceFastrepairhisBean.getSR_TYPE_CODE());
            textView_FAILURE_PROPERTY_CODE.setText(maintenanceFastrepairhisBean.getFAILURE_PROPERTY_CODE());
            textView_assignee.setText(maintenanceFastrepairhisBean.getAssignee());
            textView_ele_contract_no.setText(maintenanceFastrepairhisBean.getEle_contract_no());
            textView_accept_user.setText(maintenanceFastrepairhisBean.getAccept_user());
            textView_assign_user.setText(maintenanceFastrepairhisBean.getAssign_user());
            textView_onsite_date.setText(maintenanceFastrepairhisBean.getOnsite_date());
            textView_accept_date.setText(maintenanceFastrepairhisBean.getAccept_date());
            textView_finish_date.setText(maintenanceFastrepairhisBean.getFinish_date());
            textView_repair.setText(maintenanceFastrepairhisBean.getRepair());
            textView_COMMENTS.setText(maintenanceFastrepairhisBean.getCOMMENTS());
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.imageview_back:
                FastrepairHistoryDetailActivity.this.finish();
                break;
            default:
                break;
        }
    }
}
